package
{
import com.societyGames.codeExercise.CodeExercise;
import com.societyGames.dotsExercises.DotsCodeExercise;

public function connect(first:int, second:int, ...arguments):void
{
  for (var index:int = 0; index < arguments.length; index++)
  {
    var argument:Object = arguments[index];
    if (argument == null || !(argument is int))
    {
      throw new ArgumentError("All arguments must be integers. Argument in position: " + (index + 2) + " is not an integer.");
    }
  }
  var stroke:Vector.<int> = new Vector.<int>();
  stroke.push(first);
  stroke.push(second);
  for each (argument in arguments)
  {
    stroke.push(argument);
  }
  DotsCodeExercise(CodeExercise.instance).dotsSimulation.draw(stroke);
}
}